package com.ttx.pattern.example.state.after.states;

import com.ttx.pattern.example.state.after.GumballMachine;
import com.ttx.pattern.example.state.after.State;

/**
 * 有25分钱
 *   即 已投硬币
 * @author TimFruit
 * @date 2019/5/19 13:33
 */

public class HasQuarterSate implements State {
    private GumballMachine machine;

    public HasQuarterSate(GumballMachine gumballMachine) {
        this.machine = gumballMachine;
    }
    
    @Override public void insertQuarter() {
        System.out.println("已投入25分硬币，不能再投入硬币...");
    }

    @Override public void ejectQuarter() {
        System.out.println("退回硬币...");
        this.machine.setCurrState(this.machine.getNoQuarterState());
    }

    @Override public void turnCrank() {
        System.out.println("转动曲柄...");
        this.machine.setCurrState(this.machine.getSoldState());
    }

    @Override public void dispense() { //当前状态下，不恰当的行为
        
    }
}
